package com.leetCode.zero;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Problem01 {

	public static void main(String[] args) {
		Solution p = new Problem01().newS();
		int[] nums = {2, 7, 11, 15};
		int target = 9;	
		System.out.println(Arrays.toString(p.twoSum(nums, target)));
	}
	Solution newS(){
		return new Solution();
	}
	class Solution {
	    public int[] twoSum(int[] nums, int target) {
	        int[] reslut = new int[2];
	        for (int i = 0; i < nums.length; i++) {
				for (int j = i+1; j < nums.length; j++) {
					if((nums[i] + nums[j]) == target){
						reslut[0] = i;
						reslut[1] = j;	
					}
				}
			}
	        return reslut;
	/*		ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < nums.length; i++) {
				list.add(nums[i]);
			}
			int[] reslut = new int[2];
			for (Integer integer : list) {
				Integer left = target - integer;
				if(list.contains(left)){
					reslut[0] = i;
					reslut[1] = j;	 
				}
			}
			return reslut;*/
	    }
	}
}
